#ifndef SETUP_H
#define SETUP_H

#include <ZMainWidget.h>
#include <ZMultiLineEdit.h>
#include <ZPushButton.h>
#include <ZSetManager.h>
#include <ZScrollView.h>
#include <ZGlobal.h>
#include <ezxutilcst.h>
#include <qlistbox.h>
#include <ezxutildialog.h>
#include <ezxutillistbox.h>
//#include <ezxres.h>
#include <qpopupmenu.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qlabel.h>
#include <stdio.h>
#include <ezxres.h>


class BaseSet;
class PlugList;

class Setup : public ZMainWidget
{
	Q_OBJECT
public:
	Setup(const QString &title,ZMainWidget *parent = 0, char const *name = 0, unsigned int flags = 0);
	~Setup();
	
	BaseSet *base;
	PlugList *plugs;
signals:
	void plugsUpdated();
private:
	QPopupMenu *menu;
private slots:
	void showSetup(int p);
	void slotOK();
};


class BaseSet : public QWidget
{	
	Q_OBJECT
public:
	BaseSet(QWidget *parent = 0);
	~BaseSet();
	QComboBox *lang, *user;
	QSpinBox* fontSize;
	QCheckBox *Italic, *Bold, *fullScreen, *enablePw;
	//QRadioButton *pwOn, *pwOff;
	ZPushButton *pwOnOff, *hidePw;
	QLineEdit *password;
	
public slots:
	void setPwEnabled();
	void setPwHide();
	void readConfig();
	void saveConfig();
private:
	bool FullShow, Boldv, Italicv;
	int FontSize, bkground;
	QString Langv, Userv, pwEnable, loginUserPW;
		
};

class ListItem : public UTIL_ListBoxItem
{
public:
	ListItem(QListBox *parent ,const QPixmap &pixmap, const QString &name ,bool radio = false);
	~ListItem();
protected:
  virtual void paint(QPainter *p);
private:
  QString name;
  QPixmap pixmap;

};

class ListItem;
class PlugSet;

class PlugList : public UTIL_ListBox
{
	Q_OBJECT
public:
	PlugList(QWidget* parent = 0, unsigned int f =0);
	~PlugList();

//signals:
	//void plugsUpdated();	
public slots:
	void readConfig();
	//void itemClicked(QListBoxItem *item , const QPoint &pos);
	void released(const QPoint &pos);
	void setPlug(int id);
private:
	int total;
	int itemIndex;
	UTIL_ListBoxItem *plug;
	QPopupMenu *options;
	QStringList pathList;
	QStringList idList;
	QStringList iconList;
	QStringList nameList;
	QStringList	argsList;
	QStringList runAsList;	

protected:
	void mouseReleaseEvent(QMouseEvent *e);

};

//class RelatingDialog;
class PlugSet : public ZBaseDialog//UTIL_Dialog
{
	Q_OBJECT
public:
	PlugSet(QWidget *parent =0,const char *name = 0);
	~PlugSet();
	
	ZMultiLineEdit *plugName, *app, *icon, *arg;
	QCheckBox *closeP;
	QComboBox *runAsC;
	
	//QString ico;
	int appRunAs() { return runAsC->currentItem(); }
	QString appIcon() {return icon->text();}
	QString appName() { return plugName->text();}
	QString appPath() { return app->text(); }
	QString appArg() { return arg->text(); }
	bool fuckFilemgr() { return closeP->isChecked(); }
	void setName(QString &n) { plugName->setText(n); }
	void setPath(QString &p) { app->setText(p); }
	void setArgs(QString &a) { arg->setText(a); }
	void setIcon(QString &i) { icon->setText(i); }
	void setRunAs(int r) { runAsC->setCurrentItem(r); }
private slots:
	void selectApp();
	void selectIcon();

};
	



#endif //SETUP_H
